Database replication is a way of keeping data synchronized across multiple database systems. Changes to a database are logged as events and sent via an event-based messaging system to other database systems.
Many database systems now support complex types, which are non-scalar types that include object types, collections, reference types, and opaque types. Complex types are stored in a particular storage format. For example, the storage format of an object type may be “in-line”, where object type instances are stored as a serialized image in a column of a table or each attribute of the object type is stored as a scalar value in a separate column of a table, or the storage format may be “out-of-line”, where a reference in a table points to another table that holds the data for instances of the object type. Instances of a collection type may be stored in-line, where a collection is stored as a serialized array image within a column of the table, or out-of-line, where an identifier representing a collection is stored in one table and each element of the collection is stored in a row of another table, each row linked to the collection via the identifier.
Storage structures that store instances of an object type in a storage format are referred to herein as base structures. Thus, for example, a table that stores objects, one or more columns in the table that store the scalar attribute values of the instances, or a column in the table that holds a serialized image of the instances, are referred to herein as base structures.
When a change occurs to a complex type instance, a change is made to the base structures. Changes to an instance are replicated by propagating the changes to the base structures. For example, at a source database, a change to an attribute of an object type instance is made by changing a row and column of a table that holds data for the attribute. The change is replicated at a destination database system by propagating the change to the column to the destination via an event-based messaging system.
Replication of complex types works well within homogenous systems. A homogenous system, as the term is used herein, is a system in which, for a given complex type, the storage format, complex type versions, and attribute ordering are the same at the sites where the object is replicated. By contrast, a heterogeneous system, as the term is used herein, is a system in which, for a complex type, a storage format, complex type version, or attribute ordering is different at the sites where the complex type is replicated.
Object replication can be problematic within heterogeneous systems for various reasons. For example, a source database system stores attribute values as scalar values in separate columns of a table. The destination database system uses a serialized image stored in a single column of a table to represent an entire object type instance. Replicating the object type by replicating changes to the base structures at the source database system does not work well because the destination database system stores instances of that object type in different base structures.
In another example, both the source and destination database systems use a serialized image to represent an object type. However, in the source database system the attributes are ordered differently than in the destination database. Thus, the database system is unable to unpickle or parse the serialized image of the same object type. Or, the attribute ordering is the same but the database systems are running different releases of the same database server software, releases that format serialized images of object type instances differently.
In another example, because of schema evolution, during which object types evolve through different versions, the same object type may evolve differently on different database systems. While the same object type may exist in different database systems, the database system may not share the same version of the object type. Thus, a source database system may generate a change for an attribute and base structure neither of which exists for that object type at the destination database system. As a consequence, the destination database system is not able to replicate changes made to an instance of that object type at the source database system.
Based on the foregoing, there is a clear need to improve object replication for heterogeneous systems.
The approaches described in this section are approaches that could be pursued, but not necessarily approaches that have been previously conceived or pursued. Therefore, unless otherwise indicated, it should not be assumed that any of the approaches described in this section qualify as prior art merely by virtue of their inclusion in this section.